package cn.zktr.Personnel.model.service.ouyangpeng;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONArray;

import cn.zktr.Personnel.model.dao.ouyangpeng.RetIrwDao;
import cn.zktr.Personnel.model.dao.ouyangpeng.RetWenDao;
import cn.zktr.Personnel.model.dao.tanyali.EmaTrtsDao;
import cn.zktr.Personnel.model.mappers.ouyangpng.PerRetIttMapper;
import cn.zktr.Personnel.model.mappers.ouyangpng.PerRetRseMapper;
import cn.zktr.Personnel.model.pojos.PerIntention;
import cn.zktr.Personnel.model.pojos.PerRetIrw;
import cn.zktr.Personnel.model.pojos.PerRetRse;
import cn.zktr.Personnel.model.pojos.PerRetWAlt;
import cn.zktr.Personnel.model.pojos.PerRetWen;

/**
 * @author lenovo
 *求职意向表
 */
@Service
@Transactional(rollbackOn=Exception.class)
public class RetIttService {
	@Autowired
	private PerRetIttMapper retittmapper;
	@Autowired
	private PerRetRseMapper retrsemapper;
	@Autowired
	private RetWenDao wendao;
	@Autowired
	private RetIrwDao irwdao;
	@Autowired
	private EmaTrtsDao trtsD;
	//显示所有招聘信息
	public List<PerIntention> selectrsenameAll() {
		return retittmapper.selectrsenameAll();
	}
	//笔试id
	public List<PerRetWen> updatebishiid(Integer wenid){
		return retittmapper.updatebishiid(wenid);
	}
	//根据应聘职位模糊查询
	public List<PerIntention> selectduiwaizhi(String POTZW){
		return retittmapper.selectduiwaizhi(POTZW);
	}
	//根据计划查询
    public List<PerIntention> selectjihuafl(String altfl){
    	return retittmapper.selectjihuafl(altfl);
    }
    //考试结果增到笔试表，PerEmaTrt考试结果表
    public void fanhuiksjieguo(Integer ionid,Integer trtsid) {
    	PerRetWen wen=retittmapper.kaoshi_yixiang_bishi(ionid);
    	PerRetWen wen1 = wendao.findById(wen.getWenid()).get();
    	wen1.setPerEmaTrt(trtsD.findById(trtsid).get());
    	wendao.save(wen1);
    }
    //笔试表
    public List<PerRetWen> bishi_cx() {
    	return retittmapper.bishi_cx();
	}
    //笔试状态修改为通过
  	public void wenxiugai(Integer wenid) {
  		PerRetWen wen=wendao.findById(wenid).get();
  		wen.setWenqld("1");
  		wendao.save(wen);
  	}
    //笔试不通过
  	public void wenbutg(Integer wenid) {
  		PerRetWen wen=wendao.findById(wenid).get();
  		wen.setWenqld("2");
  		wendao.save(wen);
  	}
  	 //面试状态修改为通过
  	public void irwtongguo(Integer irwid ) {
  		PerRetIrw irw=irwdao.findById(irwid).get();
  		irw.setIrwqld("1");
  		irwdao.save(irw);
  	}
  	//添加面试时通过笔试的简历
//  	public List<PerRetWen> selectksrseid() {
//  		return retrsemapper.selectksrseid();
//  	}
  	public List<PerRetWen> selectksrseid() {
		try {
			return retrsemapper.selectksrseid();
		} catch (Exception e) {
			return null;
		}
	}
    //添加面试下拉-选中的rseid
    public List<PerRetRse> selectmianshirseidss( Integer rseid){
    	return retrsemapper.selectmianshirseidss(rseid);
    	
    }
    //根据ID查询
  	/*public List<PerRetWen> selectksrseid(Integer ksrseid) {
  		return retrsemapper.selectksrseid(ksrseid);
  	}*/
}
